From bc2ddbb91274ff9be9c1868f9f690ed74f41fe33 Mon Sep 17 00:00:00 2001 From: Felipe Sere Date: Wed, 17 Dec 2014 21:18:24 +0000 Subject: [PATCH] Removes macro and conflicting impls --- src/cargo/util/errors.rs | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 2d4ccdf75..38eb793b9 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -28,22 +28,6 @@ pub trait CargoError: Send { } } -impl FromError for Box { - fn from_error(error: E) -> Box { - box error as Box - } -} - -macro_rules! from_error { - ($ty:ty) => { - impl FromError<$ty> for $ty { - fn from_error(error: $ty) -> $ty { - error - } - } - } -} - impl Show for Box { fn fmt(&self, f: &mut Formatter) -> fmt::Result { try!(write!(f, "{}", self.description())); @@ -96,34 +80,24 @@ impl CargoError for IoError { fn description(&self) -> String { self.to_string() } } -from_error!(IoError); - impl CargoError for TomlError { fn description(&self) -> String { self.to_string() } } -from_error!(TomlError); - impl CargoError for fmt::Error { fn description(&self) -> String { "formatting failed".to_string() } } -from_error!(fmt::Error); - impl CargoError for curl::ErrCode { fn description(&self) -> String { self.to_string() } } -from_error!(curl::ErrCode); - impl CargoError for json::DecoderError { fn description(&self) -> String { self.to_string() } } -from_error!(json::DecoderError); - pub struct ProcessError { pub msg: String, pub exit: Option, @@ -132,8 +106,6 @@ pub struct ProcessError { pub cause: Option> } -from_error!(ProcessError); - impl Show for ProcessError { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let exit = match self.exit { @@ -244,8 +216,6 @@ impl CargoError for CliError { } } -from_error!(CliError); - impl CargoError for docopt::Error { fn description(&self) -> String { match *self { @@ -266,20 +236,14 @@ impl CargoError for docopt::Error { fn is_human(&self) -> bool { true } } -from_error!(docopt::Error); - impl CargoError for url::ParseError { fn description(&self) -> String { self.to_string() } } -from_error!(url::ParseError); - impl CargoError for git2::Error { fn description(&self) -> String { self.to_string() } } -from_error!(git2::Error); - impl CliError { pub fn new(error: S, code: uint) -> CliError { let error = human(error.as_slice().to_string()); -- 2.30.2